Dynomotion

Group: DynoMotion Message: 14904 From: lmp582002 Date: 7/4/2017
Subject: Spindle Pulses Counter

Question - I have a spindle motor driven by a brush-less motor controller. I am trying to write a program that will shut down if the motor stalls (stops sending pulses). The only way I can think of is not particularly elegant and am not sure if the KFlop can keep up with the speed that would be required.

  • Stall detection - if pulses stop longer than 0.1 seconds
  • Minimum Pulse frequency to shut down 800 pulses/second. (The controller sends a pulse for every commutation - it is a 4 pole motor. 12,000 RPM X 4 Poles = 48,000PPM or 800 Pulses per second)
  • Write a user program to sum all pulses in a 0.1 second time interval
  • If the sum is less than 80 shut down

Would the KFlop have any issue counting 800 pulses a second? Is there a better way? Maybe using an encoder input or something?




Group: DynoMotion Message: 14905 From: TK A2 Date: 7/4/2017
Subject: Re: Spindle Pulses Counter
Do you know the minimum pulse width of the pulse?

TK

On Jul 4, 2017, at 8:13 PM, lmp582002@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

Question - I have a spindle motor driven by a brush-less motor controller. I am trying to write a program that will shut down if the motor stalls (stops sending pulses). The only way I can think of is not particularly elegant and am not sure if the KFlop can keep up with the speed that would be required.

  • Stall detection - if pulses stop longer than 0.1 seconds
  • Minimum Pulse frequency to shut down 800 pulses/second. (The controller sends a pulse for every commutation - it is a 4 pole motor. 12,000 RPM X 4 Poles = 48,000PPM or 800 Pulses per second)
  • Write a user program to sum all pulses in a 0.1 second time interval
  • If the sum is less than 80 shut down

Would the KFlop have any issue counting 800 pulses a second? Is there a better way? Maybe using an encoder input or something?




Group: DynoMotion Message: 14906 From: lmp582002 Date: 7/4/2017
Subject: Re: Spindle Pulses Counter
Not sure, I will contact the controller manufacturer tomorrow. Is there a minimum pulse length that can be reliably detected? I suppose there is a limited ability to detect between time slices.

Seeing as how the controller can go up to 80,000 RPM theoretically that would make for 320,000 pulses per minute or 5,333 a second. That would make a pulse every 0.00087 seconds? I image it is pretty short.
Group: DynoMotion Message: 14907 From: TK A2 Date: 7/4/2017
Subject: Re: Spindle Pulses Counter
I think you have a math error.  

How frequently User Threads execute depends on how many are running. With one User Thread executing it could test the input every 180us. A User callback could test every 90us regardless of the number of active Threads. 

Using a KFLOP hardware encoder counter might be a better approach. However the encoder inputs require AB quadrature. You can simulate a B channel from the A channel by delaying it slightly with an RC filter. Set the RC to around 2us. 

Regards
TK

On Jul 5, 2017, at 12:13 AM, lmp582002@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

Not sure, I will contact the controller manufacturer tomorrow. Is there a minimum pulse length that can be reliably detected? I suppose there is a limited ability to detect between time slices.


Seeing as how the controller can go up to 80,000 RPM theoretically that would make for 320,000 pulses per minute or 5,333 a second. That would make a pulse every 0.00087 seconds? I image it is pretty short.

Group: DynoMotion Message: 14910 From: lmp582002 Date: 7/8/2017
Subject: Re: Spindle Pulses Counter
Still waiting to hear back from the Motor controller, but I have been thinking about a possible easier way. You mentioned an RC circuit as an encoder. Would it be possible to do a similar thing on one of the inputs? If I put a small capacitor in line with the input would it charge up as the pulses are being sent? After a certain time it would get all the way to 5V and activate the input?

This would just be a matter of sizing the capacitor correctly? All of JP6 and JP4 have pull down resistors dont they? So I could use any of those inputs - when the pulse train stops the capacitor would be pulled back down to 0V by the pull down resistor?
Group: DynoMotion Message: 14911 From: Tom Kerekes Date: 7/8/2017
Subject: Re: Spindle Pulses Counter

Something like that might work.  You might connect the pulse stream to a capacitor through a diode.  Any positive pulse would fully charge the capacitor.  Then add a bleed off resistor to slowly discharge the capacitor.  As long as the pulses keep coming the capacitor will stay charged and the input will read a solid high.  If the pulse stream stops or slows down enough the capacitor will have time to discharge and the input will go low.  If you constantly monitor the input and ever see a low then the Spindle would be known to be at low speed.  The pull down resistors on JP4 and JP5 are probably too strong to be practical (the capacitor would need to be too large and the current to charge it from pulse stream quickly would be huge).  But you could use an input without the pull down.  It wouldn't be very accurate as the input threshold for inputs is not precise (ie maybe from 1.0 to 1.5V)

Regards

TK


On 7/8/2017 9:25 AM, lmp582002@... [DynoMotion] wrote:
 
Still waiting to hear back from the Motor controller, but I have been thinking about a possible easier way. You mentioned an RC circuit as an encoder. Would it be possible to do a similar thing on one of the inputs? If I put a small capacitor in line with the input would it charge up as the pulses are being sent? After a certain time it would get all the way to 5V and activate the input?

This would just be a matter of sizing the capacitor correctly? All of JP6 and JP4 have pull down resistors dont they? So I could use any of those inputs - when the pulse train stops the capacitor would be pulled back down to 0V by the pull down resistor?

Group: DynoMotion Message: 14952 From: lmp582002 Date: 8/21/2017
Subject: Re: Spindle Pulses Counter

Thanks Tom!


While I am saving to replace my roasted K-Step, I wanted to try to get this spindle running. Not sure about all the math to size the capacitor and resistor. Here is my best attempt, please see schematic.


5T = R X C (5 constants to completely discharge the capacitor)


C = 1uf (seems nice and small? Have to start somewhere?)

Detection time = 0.1 seconds


5 (0.1)

---------- = R

0.000001


So the resistor should have a value of 500K ohms?


Does it look like my bleed off resistor is on the right side of the capacitor? Also would you use a schottky diode for the low forward voltage and quick response time?


Thanks!

  @@attachment@@
Group: DynoMotion Message: 14954 From: Tom Kerekes Date: 8/21/2017
Subject: Re: Spindle Pulses Counter [1 Attachment]
I'm not sure why the 5 time constants.  The input would probably switch after about 1.

I don't think you ever told us the pulse characteristics - voltage, width, current sourcing?

I was thinking of a circuit like this.

R1 would provide some current limiting to not load the pulse too much.  When the pulse goes high it would quickly charge the capacitor through R1 and D1.  Then when the pulse goes away the capacitor would slowly discharge.

Schottky diode might be a good idea.  Low leakage current might be important as the 500K  would only be bleeding 2uA at 1V

HTH

Regards

TK


On 8/21/2017 3:18 PM, lmp582002@... [DynoMotion] wrote:
 

Thanks Tom!


While I am saving to replace my roasted K-Step, I wanted to try to get this spindle running. Not sure about all the math to size the capacitor and resistor. Here is my best attempt, please see schematic.


5T = R X C (5 constants to completely discharge the capacitor)


C = 1uf (seems nice and small? Have to start somewhere?)

Detection time = 0.1 seconds


5 (0.1)

---------- = R

0.000001


So the resistor should have a value of 500K ohms?


Does it look like my bleed off resistor is on the right side of the capacitor? Also would you use a schottky diode for the low forward voltage and quick response time?


Thanks!


  @@attachment@@
Group: DynoMotion Message: 14956 From: lmp582002 Date: 8/21/2017
Subject: Re: Spindle Pulses Counter
Thanks so much! Here is the response that I got from Castle Creations, it is one of their brushless DC controllers. Comparing our diagrams I can see mine wouldnt work. 

"The pulse is directly related to the rpm of the motor (in electrical rpm (or 2 pole motor rpm)). The minimum pulse width would be calculated from the maximum rpm the controller can run. I would estimate that at 250,000 electrical rpm you would see a pulse width of about 4 microseconds."

I didnt find this particularly helpful because it sounds like the width is constantly changing. They didnt give any details on current, but I do know that it is 5V.

Do you think a 4 microsecond pulse would be long enough to charge the capacitor and energize the input? I am guessing that polarity wont matter at all on the capacitor and any 1uf one would do?


Group: DynoMotion Message: 14957 From: Tom Kerekes Date: 8/22/2017
Subject: Re: Spindle Pulses Counter

I believe it should work.  If I understood correctly, and did the math correctly, the controller outputs a 4us pulse every 240us.  Which is a 1.6% duty cycle.  Since the circuit charges the capacitor at about 1000X higher rate than the discharge rate about 0.1% duty cycle is required to charge the capacitor half way (2.5V).  The 1.6% duty cycle should keep it charged > 95% with some normally small ripple and always be high.  At a low enough frequency the ripple will be enough for the signal to go low for periods of time and easily detected by KFLOP as a fault.

For noise reasons you should use a ceramic capacitor which are usually unpolarized.

Regards

TK


On 8/21/2017 9:04 PM, lmp582002@... [DynoMotion] wrote:
 
Thanks so much! Here is the response that I got from Castle Creations, it is one of their brushless DC controllers. Comparing our diagrams I can see mine wouldnt work. 

"The pulse is directly related to the rpm of the motor (in electrical rpm (or 2 pole motor rpm)). The minimum pulse width would be calculated from the maximum rpm the controller can run. I would estimate that at 250,000 electrical rpm you would see a pulse width of about 4 microseconds."

I didnt find this particularly helpful because it sounds like the width is constantly changing. They didnt give any details on current, but I do know that it is 5V.

Do you think a 4 microsecond pulse would be long enough to charge the capacitor and energize the input? I am guessing that polarity wont matter at all on the capacitor and any 1uf one would do?